/************************************
 * created by Tonk (tonk@ctonk.com) *
 ************************************/

// vEditHandler.h

#ifndef VEDIT_HANDLER_H
#define VEDIT_HANDLER_H

#include "definitions.h"
#include "character.h"

class vEditHandler {
	private:
		Character*		_c;
		std::string*	_dest;
		int				_nLines;
		std::string		_lines[40];

		void	update();

	public:
		vEditHandler();
		vEditHandler( Character*, std::string* );
		~vEditHandler();

		vEditHandler& operator = ( vEditHandler& );

		Character*		getC();
		std::string*	getDest();
		void			setLine( int, std::string );
		std::string		getLine( int );
		void			addLine( std::string );
		void			insertLine( std::string );
		void			removeLine( std::string );
		void			replaceLine( std::string );
		int				getNlines();

		std::string		editWindow();
};

class vEditList {
	private:
		std::list< vEditHandler* > _vList;

	public:
		vEditHandler* operator [] ( std::string );

		std::list< vEditHandler* >& getList();

		void act( Character*, const string& );
		static vEditList& Instance();
};

inline vEditList& vEditList::Instance() {
	static vEditList instance;
	return instance;
}


#endif // #ifndef VEDIT_HANDLER_H
